home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
027a
/
clipio.zip
/
BLAKGLOB.PRG
< prev
next >
Wrap
Text File
|
1990-06-23
|
9KB
|
327 lines
*-----------------------------------HELPBAR------------------------------------*40
function helpbar
parameters options, keys
private lcv, count, col
* begin
vpushscrn(24, 0, 24, 79)
vfillchar(24, 0, 24, 79, 32)
count = len(options)
col = 1
for lcv = 1 to count
vputstrc(24, col, keys[lcv], _c_hlpk)
col = col + len(keys[lcv])
vputstrc(24, col, options[lcv], _c_help)
col = col + len(options[lcv]) + 2
next lcv
return ''
*-----------------------------------PROMPT-------------------------------------*
function prompt
parameters ulr, ulc, message, pop, ans0, ans1, ans2, ans3, ans4, ans5, ans6, ans7, ans8, ans9
private retval, anscount, answers, length, width, lrr, lrc,;
messlen, nc, mlength, lcv, col, anykey
* begin
if pcount() < 3
misc_error(procname(), procline(), 'too few parameters')
elseif pcount() > 14
misc_error(procname(), procline(), 'too many parameters')
endif
if pcount() < 4
pop = .t.
endif
anscount = pcount() - 4
if (anscount = 0) .and. pop
anscount = 1
ans0 = 'Ok'
anykey = .t.
else
anykey = .f.
endif
messlen = if(len(message) > 76, 76, len(message))
answers = ''
bwidth = 0
for lcv = 1 to anscount
nc = chr(lcv + 47)
answers = answers + upper(left(ans&nc, 1))
bwidth = bwidth + 4 + len(ans&nc)
next lcv
width = if(messlen > bwidth, messlen, bwidth)
mlength = mlcount(message, 76, 4, .t.)
length = mlength + if(anscount > 0, 3, 0)
if ulr < 0
if row() > 12
ulr = (row() - length - 2) / 2
else
ulr = ((23 - row() - length) / 2) + row()
endif
if (ulr < 0) .or. (ulr + length + 2 > 25)
ulr = (23 - length) / 2
endif
endif
if ulc < 0
ulc = (76 - width) / 2
endif
lrr = ulr + length + 1
lrc = ulc + width + 3
oldctrl = msavectrl(ulr, ulc, lrr, lrc)
mdefctrl(ulr, ulc, lrr, lrc, 255)
vpushstate()
vsetcolor(_c_wind_st, _c_wind_en, _c_wind_un)
vpushscrn(ulr, ulc, lrr, lrc)
@ ulr, ulc to lrr, lrc
vfillattr(ulr, ulc, lrr, lrc, vsetstan())
vfillchar(ulr+1, ulc+1, lrr-1, lrc-1, 32)
if messlen = 76
for lcv = 1 to mlength
vputstr(ulr + lcv, ulc + 2, memoline(message, 76, lcv))
next lcv
vmovecurs(ulr + mlength, ulc + 2 + len(trim(memoline(message, 76, mlength))))
else
vputstr(ulr + 1, ((width - messlen) / 2) + ulc + 2, message)
vmovecurs(ulr + 1, ((width - messlen) / 2) + ulc + 2 + len(message))
endif
col = ((width - bwidth) / 2) + ulc + 2
for lcv = 1 to anscount
nc = chr(lcv + 47)
@ ulr + mlength + 1, col to ulr + mlength + 3, col + 3 + len(ans&nc)
mdefctrl(ulr + mlength + 1, col, ulr + mlength + 3, col + 3 + len(ans&nc), lcv)
vputstr(ulr + mlength + 2, col + 2, ans&nc)
vputstrc(ulr + mlength + 2, col + 2, left(ans&nc, 1), if(!iscolor(), _c_wind_un, int(_c_wind_en / 16) + _c_wind_st - (_c_wind_st % 16)))
col = col + len(ans&nc) + 4
next lcv
retval = ''
if pop
mpushstate()
do while len(retval) = 0
kp = keygetup()
if anykey .and. (kp <> -131)
retval = chr(kp)
elseif (kp = -131) .and. (mgetbutton() = 'L ') .and. (mgetctrl() < 255)
retval = substr(answers, mgetctrl(), 1)
elseif chr(kp) $ answers
retval = chr(kp)
endif
enddo
mpopstate()
vpopscrn()
endif
mrestctrl(ulr, ulc, lrr, lrc, oldctrl)
vpopstate()
return retval
*------------------------------------PAD---------------------------------------*
function pad
parameters init_val, length
* begin
return substr(init_val + space(length), 1, length)
*-----------------------------------CENTER-------------------------------------*
function center
parameters init_val, length
private half
* begin
half = length - len(init_val)
if (half % 2 = 1) .and. (half > 0)
init_val = ' ' + init_val
half = half - 1
endif
return space(half/2) + init_val + space(half/2)
*---------------------------------UNPICTURE------------------------------------*
function unpicture
parameters string, picture
private ret_val, length, ptr
* begin
ret_val = ''
length = min(len(string), len(picture))
for ptr = 1 to length
if (upper(substr(picture, ptr, 1)) $ 'ANX9#LY!')
ret_val = ret_val + substr(string, ptr, 1)
endif
next ptr
ret_val = ret_val + substr(string, length+1, len(string))
return ret_val
*----------------------------------INC_UNIQ------------------------------------*
function inc_uniq
parameters uniq
* begin
carry = .t.
pos = 4
do while (pos >= 1) .and. carry
carry = (substr(uniq, pos, 1) = chr(255))
uniq = substr(uniq, 1, pos - 1) +;
if(carry, chr(1), chr(asc(substr(uniq, pos, 1)) + 1)) +;
substr(uniq, pos + 1, len(uniq))
pos = pos - 1
enddo
return uniq
*----------------------------------RPT_COLUMNS---------------------------------*
function rpt_columns
parameters columns, lengths
private ret_val, lcv, length
* begin
ret_val = ''
length = len(columns)
for lcv = 1 to length-1
ret_val = ret_val + center(columns[lcv], lengths[lcv]) + ' '
next lcv
ret_val = ret_val + center(columns[length], lengths[length])
return ret_val
*-------------------------------RPT_UNDERLINE----------------------------------*
function rpt_underline
parameters lengths
private ret_val, lcv, length
* begin
ret_val = ''
length = len(lengths)
for lcv = 1 to length-1
ret_val = ret_val + replicate('_', lengths[lcv]) + ' '
next lcv
ret_val = ret_val + replicate('_', lengths[length])
return ret_val
*----------------------------------RPT_LINE------------------------------------*
function rpt_line
parameters fields, lengths
private ret_val, lcv, command, length
* begin
ret_val = ''
length = len(fields)
for lcv = 1 to length-1
command = fields[lcv]
ret_val = ret_val + pad(&command, lengths[lcv]) + ' '
next lcv
command = fields[length]
ret_val = ret_val + pad(&command, lengths[length])
return ret_val
*----------------------------------GET_KEY-------------------------------------*
function get_key
private ret_val
* begin
ret_val = indexkey(0)
return &ret_val
*------------------------------------MPIC--------------------------------------*
function mpic
parameters var, pic
* begin
if pcount() < 2
pic = ''
endif
mdefctrl(row(), col(), row(), col() + len(transform(var, pic)), piccount)
piccount = piccount + 1
return pic
*----------------------------------FINDCLICK-----------------------------------*
function findclick
parameters callprog, linenum, inputvar
private ctrl, lcv, key
* begin
if (mgetbutton() == 'L ') .and. (mgetctrl() > 0) .and. (mgetctrl() < 32)
ctrl = mgetctrl() - mgetctrl(row(), col()-1)
if ctrl < 0
key = -72
ctrl = -ctrl
else
key = -80
endif
for lcv = 1 to ctrl
keyinsert(key)
next lcv
endif
return ''
*--------------------------------BLAKDIAL--------------------------------------*
function blakdial
parameters callprog, linenum, inputvar
private dialstr, local
* begin
if (substr(PHONE, 2, 3) == _areacode)
dialstr = trim(_localpre) + substr(PHONE, 6, 8) + trim(_localsuf)
else
dialstr = trim(_longpre) + PHONE + trim(_longsuf)
endif
prompt(12, -1, 'Dialing ' + dialstr + '. Please wait...', .f.)
fwrite(fopen(_comport, 1), 'atdt' + dialstr + chr(13))
tone(0, 5)
vpopscrn()
prompt(12, -1, 'Pick up receiver and press any key...', .t.)
fwrite(fopen(_comport, 1), 'ath')
longtimer()
return ''
*--------------------------------LONGTIMER-------------------------------------*
function longtimer
private t0, row, et, minutes
* begin
t0 = seconds()
prompt(-1, -1, 'Length of this call minutes seconds. Press any key to stop timer...', .f.)
row = row()
do while (inkey(.1) = 0)
et = round(seconds() - t0, 0)
minutes = int(et/60)
vputstr(row, 22, str( minutes, 3, 0 ))
vputstr(row, 34, str( et - (minutes * 60), 2, 0))
enddo
vpopscrn()
return ''
*--------------------------------FREE_MEMORY-----------------------------------*
procedure Free_Memory
parameters callprog, linenum, inputvar
* begin
prompt(-1, -1, 'Free Memory: ' + ltrim(str(memory(0))) + 'K', .t.)
return